<?php
App::uses('AppController', 'Controller');
class UsersNewController extends AppController{
    public $uses = array('Users');
    function beforeFilter(){
        parent::beforeFilter();
        $this->layout = 'font_end';
    }
    function index(){
        if(!empty($this->request->data)){
            $dataPost = $this->request->data;
            $fullName = $dataPost['fullname'];
            $email    = $dataPost['email'];
            $skype    = $dataPost['skype'];
            $userCurrent = $this->Auth->user();
            $newInfo =  $dataPost + $userCurrent;
            $arrUserUpdate = array('Users' => array(
                                            'id'        =>  $userCurrent['id'],
                                            'full_name' =>  $fullName,
                                            'email'     =>  $email,
                                            'skype'     =>  $skype 
                                    ));
            $this->Users->save($arrUserUpdate);
            $this->Auth->login($newInfo);
            $this->redirect("/UsersNew/index");
        }
    }
} 
?>